package plugin;

import static org.junit.Assert.*;

import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;

import plugin.UPCDBOrgPlugin;

public class TestUPCDBOrgPlugin {

	private UPCDBOrgPlugin theObject;
	
	@BeforeClass
	public static void setUpBeforeClass() throws Exception {
	}

	@AfterClass
	public static void tearDownAfterClass() throws Exception {
	}

	@Before
	public void setUp() throws Exception {
		theObject = new UPCDBOrgPlugin();
	}

	@After
	public void tearDown() throws Exception {
		
	}

	@Test
	public void test() {
		try {
			String result = theObject.identifyProduct("016000275164");
			assertEquals(result, "GENERAL MILLS, INC. 12 oz. (340g) Golden Graham cereals - General Mills");
		} catch (Exception e) {
			e.printStackTrace();
		}
		
		try {
			String result = theObject.identifyProduct("024100440689");
			assertEquals(result, "Sunshine Biscuits, LLC. - Sunshine Cheez-It Baked Snack Crackers");
		} catch (Exception e) {
			e.printStackTrace();
		}
		
		try {
			String result = theObject.identifyProduct("031200016058");
			assertEquals(result, " 14.00 OZ OS JELLIED CRAN SAUCE");
		} catch (Exception e) {
			e.printStackTrace();
		}
		
		try{
			String result = theObject.identifyProduct("000000000001");
		} catch (Exception e){
			System.out.println("passed invalid item test");
		}
		
	}

}
